home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC_Samples / propdlg / propsht.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  2.1 KB  |  76 lines

  1. // propsht.cpp : implementation of the CModalShapePropSheet class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1999 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "propdlg.h"
  15. #include "resource.h"
  16. #include "shapeobj.h"
  17. #include "colorpge.h"
  18. #include "stylepge.h"
  19. #include "propsht.h"
  20.  
  21. IMPLEMENT_DYNAMIC(CModalShapePropSheet, CPropertySheet)
  22.  
  23. BEGIN_MESSAGE_MAP(CModalShapePropSheet, CPropertySheet)
  24.     //{{AFX_MSG_MAP(CModalShapePropSheet)
  25.     ON_COMMAND(ID_APPLY_NOW, OnApplyNow)
  26.     //}}AFX_MSG_MAP
  27. END_MESSAGE_MAP()
  28.  
  29. CModalShapePropSheet::CModalShapePropSheet(CWnd* pWndParent)
  30.     : CPropertySheet(AFX_IDS_APP_TITLE, pWndParent)
  31. {
  32.     AddPage(&m_stylePage);
  33.     AddPage(&m_colorPage);
  34. }
  35.  
  36. BOOL CModalShapePropSheet::OnInitDialog()
  37. {
  38.     BOOL bResult = CPropertySheet::OnInitDialog();
  39.  
  40.     return bResult;
  41. }
  42.  
  43. void CModalShapePropSheet::SetSheetPropsFromShape(CShape* pShape)
  44. {
  45.     m_stylePage.m_nShapeStyle = pShape->m_shapestyle;
  46.     m_stylePage.SetModified(FALSE);
  47.  
  48.     m_colorPage.m_nColor = pShape->m_shapecolor;
  49.     m_colorPage.SetModified(FALSE);
  50.  
  51.     // Reflect the new shape properties in the controls of the
  52.     // currently active property page.
  53.     GetActivePage()->UpdateData(FALSE);
  54. }
  55.  
  56. void CModalShapePropSheet::SetShapePropsFromSheet(CShape* pShape)
  57. {
  58.     pShape->m_shapecolor = m_colorPage.m_nColor;
  59.     pShape->m_shapestyle = (SHAPE_STYLE)m_stylePage.m_nShapeStyle;
  60.  
  61.     m_colorPage.SetModified(FALSE);
  62.     m_stylePage.SetModified(FALSE);
  63. }
  64.  
  65. void CModalShapePropSheet::OnApplyNow()
  66. {
  67.     Default();
  68.  
  69.     CFrameWnd* pFrameWnd = STATIC_DOWNCAST(CFrameWnd, AfxGetMainWnd());
  70.     CView* pView = pFrameWnd->GetActiveFrame()->GetActiveView();
  71.     pView->SendMessage(WM_USER_CHANGE_OBJECT_PROPERTIES, 0, 0);
  72.     m_stylePage.SetModified(FALSE);
  73.     m_colorPage.SetModified(FALSE);
  74.     SendMessage(PSM_CANCELTOCLOSE);
  75. }
  76.